; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes='sroa<preserve-cfg>' < %s -S | FileCheck %s --check-prefixes=CHECK,CHECK-PRESERVE-CFG
; RUN: opt -passes='sroa<modify-cfg>' < %s -S | FileCheck %s --check-prefixes=CHECK,CHECK-MODIFY-CFG

define void @f(i1 %i) {
; CHECK-LABEL: @f(
; CHECK-NEXT:    [[A1:%.*]] = alloca i64, align 8
; CHECK-NEXT:    [[A2:%.*]] = alloca i64, align 8
; CHECK-NEXT:    br i1 [[I:%.*]], label [[BB1:%.*]], label [[BB:%.*]]
; CHECK:       bb:
; CHECK-NEXT:    br label [[BB2:%.*]]
; CHECK:       bb1:
; CHECK-NEXT:    br label [[BB2]]
; CHECK:       bb2:
; CHECK-NEXT:    [[TMP3:%.*]] = phi ptr [ [[A1]], [[BB1]] ], [ [[A2]], [[BB]] ]
; CHECK-NEXT:    [[TMP5:%.*]] = load i32, ptr [[TMP3]], align 4
; CHECK-NEXT:    [[TMP4:%.*]] = load i64, ptr [[TMP3]], align 4
; CHECK-NEXT:    call void @use32(i32 [[TMP5]])
; CHECK-NEXT:    call void @use64(i64 [[TMP4]])
; CHECK-NEXT:    ret void
;
  %a1 = alloca i64
  %a2 = alloca i64
  br i1 %i, label %bb1, label %bb

bb:
  br label %bb2

bb1:
  br label %bb2

bb2:
  %tmp3 = phi ptr [ %a1, %bb1 ], [ %a2, %bb ]
  %tmp5 = load i32, ptr %tmp3
  %tmp4 = load i64, ptr %tmp3
  call void @use32(i32 %tmp5)
  call void @use64(i64 %tmp4)
  ret void
}

declare void @use32(i32)
declare void @use64(i64)
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; CHECK-MODIFY-CFG: {{.*}}
; CHECK-PRESERVE-CFG: {{.*}}
